﻿        
        //过滤手机号函数
        function checkPhone(strPhone)
        {
            var flag=false; 
             
            if(strPhone.length!=11)
            {
             flag=false; 
             
            }else
            {
             var str=strPhone.substr(0, 2);
                switch (str)
                {
                    case "13":
                      flag=true;
                      break;
                    case "14":
                      flag=true;
                      break;
                    case "15":
                      flag=true;
                      break;
                    case "17":
                      flag=true;
                      break;
                    case "18":
                      flag=true;
                      break;
        
                }
            }
             

             
            return flag;

        }
        
        function getIpPlace() 
        {
          //alert(remote_ip_info["province"] + "省" + ',' + remote_ip_info["city"] + "市")
          if(remote_ip_info["city"]==""||remote_ip_info["city"]==null)
          {
               if (document.getElementById("city_name")) {document.getElementById("city_name").value="北京";} //单程的起始城市
               if (document.getElementById("city_name3")) {document.getElementById("city_name3").value="北京";} //按行程查询的起始城市
               if (document.getElementById("city_name5")) {document.getElementById("city_name5").value="北京";}//按行程查询的起始城市
               if (document.getElementById("city_name7")) {document.getElementById("city_name7").value="北京";}//服务起始城市
//               document.getElementById("city_name2").value="北京";//往访的起始城市
//               document.getElementById("city_name4").value="北京";//按行程查询的起始城市
           
          }else
          {
               if (document.getElementById("city_name")) {document.getElementById("city_name").value=remote_ip_info["city"];}//单程的起始城市
                //document.getElementById("city_name2").value=remote_ip_info["city"];//往访的起始城市
               if (document.getElementById("city_name3")) {document.getElementById("city_name3").value=remote_ip_info["city"];}//按行程查询的起始城市
               if (document.getElementById("city_name5")) {document.getElementById("city_name5").value=remote_ip_info["city"];}//按行程查询的起始城市
               if (document.getElementById("city_name7")) {document.getElementById("city_name7").value=remote_ip_info["city"];}//服务起始城市
                
          }
          //document.getElementById("city_name1").value="拼音/汉字";//单程的起始城市
              var jintian=GetDay(0);//今天
              var houtian=GetDay(1); //明天日期
              var dahoutian=GetDay(3);//大后天日期
              if (document.getElementById("cfrq_dc")) {document.getElementById("cfrq_dc").value=houtian;} //单程起始日期
              if (document.getElementById("cfrq_jjj")) {document.getElementById("cfrq_jjj").value=GetDay(2);}//往访的起始日期
              if (document.getElementById("fhrq_jjj")) {document.getElementById("fhrq_jjj").value=GetDay(4);}//往访的起始日期
              if (document.getElementById("fhrq_wf")) {document.getElementById("fhrq_wf").value=dahoutian;}  //往访的返回日期
              if (document.getElementById("ahbcx_riqi")) {document.getElementById("ahbcx_riqi").value=jintian;}  //按航班查询日期
              //document.getElementById("axccx_riqi").value=jintian;  //按行程查询日期
              
          
        } 
       
       function GetDay(ts) //获取时间函数
        {   
            var   today=new Date();      
            var   yesterday_milliseconds=today.getTime()+1000*60*60*24*ts;      
            var   yesterday=new   Date();      
            yesterday.setTime(yesterday_milliseconds);      
            var strYear=yesterday.getFullYear();   
            var strDay=yesterday.getDate();   
            var strMonth=yesterday.getMonth()+1;   
            if(strMonth<10)   
            {   
                strMonth="0"+strMonth;   
            }   
            var strYesterday=strYear+"-"+strMonth+"-"+strDay;   
            return strYesterday;
           
        } 
        
        function TabFoucs(inputid,strvalue) //tab健焦点转移
        {
           
           if(inputid=="city_name")
           {
             //document.getElementById("city_name1").focus();
             document.getElementById("002").click();
             
             
           }
           if(inputid=="city_name1")
           {
           //&&document.getElementById("city_name1")==strvalue
		   if (document.getElementById('003con'))
		   {
             document.getElementById('003con').className='select-con  public-style select-focus';
             document.getElementById('003list').className='select-list db';
		   }else if (document.getElementById('go-off-date'))
		   {
				document.getElementById('go-off-date').focus();
		   }
             
             //document.getElementById("city_name1").blur();
         
           }
           if(inputid=="001")
           {
             document.getElementById("city_name1").focus();
           }
           if(inputid=="002")
           {
              document.getElementById("city_name1").blur();
             document.getElementById('003con').className='select-con  public-style select-focus';
             document.getElementById('003list').className='select-list db';
           }
           if(inputid=="003")
           {
             document.getElementById('004con').className='select-con  public-style select-focus';
             document.getElementById('004list').className='select-list db';
           }
           if(inputid=="004")
           {
             document.getElementById("005").focus();
           }
           if(inputid=="city_name3")
           {
             //document.getElementById("city_name4").focus();
             document.getElementById("004").click();
              
           }
           if(inputid=="city_name4")
           {
             document.getElementById("ahbcx_riqi").focus();
           }
           
           if(inputid=="city_name5")
           {
             //document.getElementById("city_name6").focus();
             //document.getElementById("006").focus();
              document.getElementById("006").click();
           }
           if(inputid=="city_name6")
           {
             document.getElementById("cfrq_jjj").focus();
           }
        }
        
        
        function getchengshi_szm(str_cs)
        {
            str_szm="AKU,ALA,AAT,AMS,AAQ,TSE,AKA,AQG,AKL,MCO,ORL,BWI,BAK,PAR,DPS,BCN,PER,BAV,BSD,BHY,PEK,AEB,FRU,BOS,PDX,BUD,BHK,BNE,BRU,CZX,CHG,CTU,CIF,OKA,DRW,KIX,DLU,DLC,DAT,DQA,DXB,DIG,DTW,DOY,DUS,DNH,YTO,DSN,ENH,ERL,FRA,PHL,FOC,FUG,KVD,CPH,CAN,KWE,KWL,HRB,HIA,HAK,HMI,HLD,HAM,HZG,HDG,HGH,HFE,HTN,HAN,HEL,HET,WAW,WAS,JGD,JXA,IEV,KUL,TNA,KGD,JMU,JGN,JJN,JZH,KHG,KRT,CAI,CBR,CGN,KJA,CLE,KRL,KMG,LXA,LAS,LHW,RDM,LYS,RIX,LIS,LJG,LLB,LYI,KOJ,LON,LAD,LAX,MAD,MLA,GDX,MNL,NZH,BKK,LUM,MXP,MOW,MEL,MDG,MUC,KHN,NKG,NNG,NAO,NCE,NGB,NYC,PIT,HKT,NDG,JIQ,CIT,TAO,IQN,SYX,XMN,SWA,SHA,PVG,SZX,SHE,LED,SAN,SJW,SYM,STO,STR,ZRH,TCG,TAS,TPE,TYN,TVS,TCZ,TSN,THQ,TGO,TLQ,VAR,WEH,VCE,VIE,WEF,WNZ,WUA,ULN,HLH,URC,WUX,WUH,XIY,XNN,JHG,SEA,SYD,XIL,HKG,SIN,OVB,ACX,HOU,XUZ,YKS,ATL,YNT,ENY,YNJ,YNZ,SVX,IKT,YIN,YIH,INC,UYN,YCU,CTS,ZHA,DYG,CGQ,CSX,CIH,CGO,CHI,ZHY,CKG,ZUH,GVA,BKI,TYO,ADD,NBO,AUH,PUS,XNT,AOG,JNZ,LYA,NNY,IST,CCU,KOW,HTA,PO1,HAJ,ES1,DO1,DU1,DR1,BO1,MA1,BN1,HE1,HG1,CMB,BOM,KCA,BHX,ABJ,NUE,ODS,ROM,SFO,TRN,SCN,ATH,MEM,MAN,PHX,YVR,MLE,JIU,LYG,FLR,NTG,MIG,DEN,OAK,YYJ,BER,XFN,OSL,GOT,ZAG,BUH,PRG,CKY,MLW,DKR,FNA,FIH,BJL,YAO,TLS,BIO,PUW,GEG,ANC,EUG,SAC,SJC,BOI,PSC,YMQ,ADL,WLG,KRY,DFW,YTY,JNG,MSO,RNO,MRS,SHP,NLT,YOW,ZYI,HJJ,MSP,HYN,BPL,YZY,HZH,IQM,YYC,MIA,YYT,YYG,YQM,YQT,YQB,YHZ,WNH,YIW,LZH,JUH,CGD,DDG,HEK,JDZ,JIL,KJI,LZO,MXZ,OHE,RLK,TEN,YBP,TXN,YIC,YIE,ZJO,LLV,JUZ,KHH,HEL,KHV,LYS"
            str_cs_cn="阿克苏|阿拉木图|阿勒泰|阿姆斯特丹|阿纳帕|阿斯塔纳|安康|安庆|奥克兰(新西兰)|奥兰多|奥兰多赫恩登|巴尔蒂摩|巴库|巴黎|巴厘岛|巴塞罗那|柏斯|包头|保山|北海|北京|百色|比什凯克|波士顿|波特兰|布达佩斯|布哈拉|布里斯本|布鲁塞尔|常州|朝阳|成都|赤峰|冲绳|达尔文|大阪|大理|大连|大同|大庆|迪拜|迪庆|底特律|东营|杜塞尔多夫|敦煌|多伦多|鄂尔多斯|恩施|二连浩特|法兰克福|费城|福州|阜阳|甘贾|哥本哈根|广州|贵阳|桂林|哈尔滨|淮安|海口|哈密|海拉尔|汉堡|汉中|邯郸|杭州|合肥|和田|河内|赫尔辛基|呼和浩特|华沙|华盛顿|加格达奇|鸡西|基辅|吉隆坡|济南|加里宁格勒|佳木斯|嘉峪关|晋江|九寨沟|喀什|喀土穆|开罗|堪培拉|科隆|克拉斯诺亚尔斯克|克利夫兰|库尔勒|昆明|拉萨|拉斯维加斯|兰州|雷德蒙德|里昂|里加|里斯本|丽江|荔波|临沂|鹿儿岛|伦敦|罗安达|洛杉矶|马德里|马尔他|马加丹|马尼拉|满洲里|曼谷|芒市|米兰|莫斯科|墨尔本|牡丹江|慕尼黑|南昌|南京|南宁|南充|尼斯|宁波|纽约|匹兹堡|普吉|齐齐哈尔|黔江|奇姆肯特|青岛|庆阳|三亚|厦门|汕头|上海虹桥|上海浦东|深圳|沈阳|圣彼得堡|圣地亚哥|石家庄|思茅|斯德哥尔摩|斯图加特|苏黎世|塔城|塔什干|台北桃园|太原|唐山|腾冲|天津|天水|通辽|吐鲁番|瓦纳|威海|威尼斯|维也纳|潍坊|温州|乌海|乌兰巴托|乌兰浩特|乌鲁木齐|无锡|武汉|西安|西宁|西双版纳|西雅图|悉尼|锡林浩特|香港|新加坡|新西伯利亚|兴义|休斯顿|徐州|雅库茨克|亚特兰大|烟台|延安|延吉|盐城|叶卡捷琳堡|伊尔库茨克|伊宁|宜昌|银川|榆林|运城|札幌|湛江|张家界|长春|长沙|长治|郑州|芝加哥|中卫|重庆|珠海|日内瓦|沙巴|东京|亚的斯亚贝巴|内罗毕|阿布扎比|釜山|邢台|鞍山|锦州|洛阳|南阳|伊斯坦布尔|加尔各答|赣州|赤塔|波茨坦|汉诺威|埃森|多特蒙德|杜伊斯堡|德累斯顿|波鸿|曼海姆|波恩|海德堡|哈根|科伦坡|孟买|库车|伯明翰|阿比让|纽伦堡|奥德萨|罗马|旧金山|都灵|萨尔布吕肯|雅典|孟菲斯|曼彻斯特|菲尼克斯|温哥华|马累|九江|连云港|佛罗伦萨|南通|绵阳|丹佛|奥克兰（美国）|维多利亚|柏林|襄阳|奥斯陆|哥德堡|萨格勒布|布加勒斯特|布拉格|科纳克里|蒙罗维亚|达喀尔|弗里敦|金沙萨|班珠尔|雅温得|图卢兹|毕尔巴鄂|普尔曼|斯波坎|安克雷奇|尤金|萨克拉门托|圣何塞|博伊西|帕斯科|蒙特利尔|阿德莱德|惠灵顿|克拉玛依|达拉斯|扬州|济宁|米苏拉|雷诺|马赛|秦皇岛|那拉提|渥太华|遵义|怀化|明尼阿波利斯|台州|博乐|张掖|黎平|且末|卡尔加里|迈阿密|圣约翰斯|夏洛特|蒙克顿|雷湾|魁北克|哈利法克斯|文山|义乌|柳州|九华山|常德|丹东|黑河|景德镇|吉林|喀纳斯|泸州|梅州|漠河|巴彦淖尔|铜仁|宜宾|黄山|宜春|阿尔山|张家口|吕梁|衢州|高雄|赫尔辛基|哈巴罗夫斯克|里昂"
            var str_szm_sz= new Array(); //定义一数组 
            var str_cs_sz= new Array(); //定义一数组 
            str_cs_sz=str_cs_cn.split("|"); //字符分割 
            str_szm_sz=str_szm.split(","); //字符分割 
            var str_szm="";
            var str_csm="";
            var return_str="";
            for (i=0;i<str_cs_sz.length ;i++ ) 
            { 
              if(str_cs_sz[i]==str_cs)
              {
                return_str=str_szm_sz[i];
                //alert(str_szm_sz[i]);
                break;
              }
            } 
            return return_str;
     
            
        }
        
     function form_submit_hzp(str_type)//表单提交
      {
        if(str_type=="form_hbsel"||str_type=="form_hbsel_jjj")//航班查询+机加酒
        {
             if(str_type=="form_hbsel")
             {
 
                  if(document.getElementById("city_name").value=="")
                  {
                    alert("请选择出发城市");
                    return false;
                  }
                  if(document.getElementById("city_name1").value=="")
                  {
                    alert("请选择到达城市");
                    return false;
                  }
                  //人数限制15-03-25
                  var renshu=parseInt(document.getElementById("chengren_xiala").value)+parseInt(document.getElementById("ertong_xiala").value);
                  if(renshu>5)
                  {
                    alert("成人及儿童的总人数不能超过5人");
                    return false;
                  }
                  //人数限制15-03-25
                  document.getElementById("DD1").value=document.getElementById("cfrq_dc").value; //出发日期

                  document.getElementById("TA").value=document.getElementById("chengren_xiala").value;         //成人数
                  document.getElementById("TC").value=document.getElementById("ertong_xiala").value;        //儿童数
                  //document.getElementsByName("TI").value=document.getElementById("").value;        //婴儿数
                  document.getElementById("ORI").value=getchengshi_szm(document.getElementById("city_name").value);       //出发城市3字码
                  document.getElementById("DES").value=getchengshi_szm(document.getElementById("city_name1").value);       //到达城市3字码
                  document.getElementById("SC").value=document.getElementById("jingjicang").value;       //舱位等级
                  document.getElementById("ICS").value=document.getElementById("gudingshijian").value;       //固定时间
                  document.getElementById("PT_bs_flight").value="F";       //航班查询标志
                  document.getElementById("PT_bs_hotel").value="";       //航班查询标志
                  var zt = document.getElementsByName("tripType");
                  var str_check="";
                  for(var i=0;i<zt.length;i++)
                  {
                      if(zt[i].checked) 
                      {
                        str_check=zt[i].value;
                      }
                  }
                  if(str_check=="1")
                  {
                    document.getElementById("FLC_bs").value="1";
                    
                  }
                  else
                  {
                    document.getElementById("FLC_bs").value="2";
                    document.getElementById("DD2").value=document.getElementById("fhrq_wf").value; //返回日期
                  }
             
                  document.getElementById('form_hbsel').action="http://new.hnair.com/hainanair/ibe/deeplink/ancillary.do";
                  document.getElementById('form_hbsel').submit();
                  
                  
             }

              if(str_type=="form_hbsel_jjj")
              {
                   
                  if(document.getElementById("city_name5").value=="")
                  {
                    alert("请选择出发城市");
                    return false;
                  }
                  if(document.getElementById("city_name6").value=="")
                  {
                    alert("请选择到达城市");
                    return false;
                  }
                  //人数限制15-03-25
                  var renshu=parseInt(document.getElementById("chengren_xiala").value)+parseInt(document.getElementById("ertong_xiala").value);
                  if(renshu>5)
                  {
                    alert("成人及儿童的总人数不能超过5人");
                    return false;
                  }
                  //人数限制15-03-25
                  document.getElementById("DD1_jjj").value=document.getElementById("cfrq_jjj").value; //出发日期
                  document.getElementById("DD2_jjj").value=document.getElementById("fhrq_jjj").value; //返回日期
                  document.getElementById("TA_jjj").value=document.getElementById("chengren_xiala_jd").value;         //成人数
                  document.getElementById("TC_jjj").value=document.getElementById("ertong_xiala_jd").value;        //儿童数
                  document.getElementsByName("NOR_jjj").value=document.getElementById("jiudianfangjian").value;        //房间数
                  document.getElementById("ORI_jjj").value=getchengshi_szm(document.getElementById("city_name5").value);       //出发城市3字码
                  document.getElementById("DES_jjj").value=getchengshi_szm(document.getElementById("city_name6").value);       //到达城市3字码
                  document.getElementById("SC_jjj").value=document.getElementById("cangwei_jjj").value;       //舱位等级
                  document.getElementsByName("ICS").value=document.getElementById("gudingshijian").value;       //固定时间
                  document.getElementById("NOR_jjj").value=document.getElementById("jiudianfangjian").value;  
              
                  document.getElementById("PT_bs_flight_jjj").value="F";       //航班查询标志
                  document.getElementById("PT_bs_hotel_jjj").value="H";       //航班查询标志
                  document.getElementById("FLC_bs_jjj").value="2";
                  if(document.getElementById("jiudianfangjian").value==1) //如果是1间房
                  {
                      document.getElementById("NA1").value=document.getElementById("chengren_xiala_jd").value;
                      if(document.getElementById("ertong_xiala_jd").value>0)
                      {
                       document.getElementById("NC1").value=document.getElementById("ertong_xiala_jd").value;
                      }
                  }
                 if(document.getElementById("jiudianfangjian").value==2) //如果是2间房
                  {
                              var jjj_div=document.getElementById("jjj_input");
                              if(document.getElementById("chengren_xiala_jd").value==2)//如果是2间房如果有2个成人
                              {
                                    if(document.getElementById("ertong_xiala_jd").value==0)//如果有0个儿童
                                    {
                                       document.getElementById("NA1").value="1";
                                       document.getElementById("NA2").value="1";
                                       var NA3=document.getElementById("NA3");
                                       jjj_div.removeChild(NA3);
                                       var NA4=document.getElementById("NA4");
                                        jjj_div.removeChild(NA4);
                                       var NA5=document.getElementById("NA5");
                                        jjj_div.removeChild(NA5);
                                        
                                        var NC1=document.getElementById("NC1");
                                         jjj_div.removeChild(NC1);
                                        var NC2=document.getElementById("NC2");
                                         jjj_div.removeChild(NC2);
                                        var NC3=document.getElementById("NC3");
                                         jjj_div.removeChild(NC3);
                                        var NC4=document.getElementById("NC4");
                                         jjj_div.removeChild(NC4);
                                       
                                    }
                                    if(document.getElementById("ertong_xiala_jd").value==1)//如果有1个儿童
                                    {
                                       document.getElementById("NA1").value="1";
                                       document.getElementById("NA2").value="1";
                                       document.getElementById("NC1").value="1";
                                       
                                       var NA3=document.getElementById("NA3");
                                       jjj_div.removeChild(NA3);
                                       var NA4=document.getElementById("NA4");
                                        jjj_div.removeChild(NA4);
                                       var NA5=document.getElementById("NA5");
                                        jjj_div.removeChild(NA5);
                                        
                                        var NC2=document.getElementById("NC2");
                                         jjj_div.removeChild(NC2);
                                        var NC3=document.getElementById("NC3");
                                         jjj_div.removeChild(NC3);
                                        var NC4=document.getElementById("NC4");
                                         jjj_div.removeChild(NC4);
                                    }
                                    if(document.getElementById("ertong_xiala_jd").value==2)//如果有2个儿童
                                    {
                                       document.getElementById("NA1").value="1";
                                       document.getElementById("NA2").value="1";
                                       document.getElementById("NC1").value="1";
                                       document.getElementById("NC2").value="1";
                                       
                                       var NA3=document.getElementById("NA3");
                                       jjj_div.removeChild(NA3);
                                       var NA4=document.getElementById("NA4");
                                        jjj_div.removeChild(NA4);
                                       var NA5=document.getElementById("NA5");
                                        jjj_div.removeChild(NA5);
                                        
                                        var NC3=document.getElementById("NC3");
                                         jjj_div.removeChild(NC3);
                                        var NC4=document.getElementById("NC4");
                                         jjj_div.removeChild(NC4);
                                       
                                    }
                              }
                              if(document.getElementById("chengren_xiala_jd").value==3)//如果是2间房如果有3个成人
                              {
                                        if(document.getElementById("ertong_xiala_jd").value==0)//如果有0个儿童
                                        {
    
                                           document.getElementById("NA1").value="2";
                                           document.getElementById("NA2").value="1";
                                           var NA3=document.getElementById("NA3");
                                           jjj_div.removeChild(NA3);
                                           var NA4=document.getElementById("NA4");
                                            jjj_div.removeChild(NA4);
                                           var NA5=document.getElementById("NA5");
                                            jjj_div.removeChild(NA5);
                                            
                                            var NC1=document.getElementById("NC1");
                                             jjj_div.removeChild(NC1);
                                            var NC2=document.getElementById("NC2");
                                             jjj_div.removeChild(NC2);
                                            var NC3=document.getElementById("NC3");
                                             jjj_div.removeChild(NC3);
                                            var NC4=document.getElementById("NC4");
                                             jjj_div.removeChild(NC4);
                                        }
                                        if(document.getElementById("ertong_xiala_jd").value==1)//如果有1个儿童
                                        {
                               
                                           document.getElementById("NA1").value="2";
                                           document.getElementById("NA2").value="1";
                                           var NA3=document.getElementById("NA3");
                                           jjj_div.removeChild(NA3);
                                           var NA4=document.getElementById("NA4");
                                            jjj_div.removeChild(NA4);
                                           var NA5=document.getElementById("NA5");
                                            jjj_div.removeChild(NA5);
                                            
                                            var NC1=document.getElementById("NC1");
                                             jjj_div.removeChild(NC1);
                                            
                                            document.getElementById("NC2").value="1";
                                             
                                            var NC3=document.getElementById("NC3");
                                             jjj_div.removeChild(NC3);
                                            var NC4=document.getElementById("NC4");
                                             jjj_div.removeChild(NC4);
                                        }
                                        if(document.getElementById("ertong_xiala_jd").value==2)//如果有2个儿童
                                        {
                                           document.getElementById("NA1").value="2";
                                           document.getElementById("NA2").value="1";
                                           
                                           var NA3=document.getElementById("NA3");
                                           jjj_div.removeChild(NA3);
                                           var NA4=document.getElementById("NA4");
                                            jjj_div.removeChild(NA4);
                                           var NA5=document.getElementById("NA5");
                                            jjj_div.removeChild(NA5);
                                            
                                            document.getElementById("NC1").value="1";
                                            document.getElementById("NC2").value="1";
                                             
                                            var NC3=document.getElementById("NC3");
                                             jjj_div.removeChild(NC3);
                                            var NC4=document.getElementById("NC4");
                                             jjj_div.removeChild(NC4);
                                        }
                              }
                              if(document.getElementById("chengren_xiala_jd").value==4)//如果是2间房如果有4个成人
                              {
                                    if(document.getElementById("ertong_xiala_jd").value==0)//如果有2个儿童
                                    {
                                           document.getElementById("NA1").value="2";
                                           document.getElementById("NA2").value="2";
                                       var NA3=document.getElementById("NA3");
                                       jjj_div.removeChild(NA3);
                                       var NA4=document.getElementById("NA4");
                                        jjj_div.removeChild(NA4);
                                       var NA5=document.getElementById("NA5");
                                        jjj_div.removeChild(NA5);
                                        
                                        var NC1=document.getElementById("NC1");
                                         jjj_div.removeChild(NC1);
                                        var NC2=document.getElementById("NC2");
                                         jjj_div.removeChild(NC2);
                                        var NC3=document.getElementById("NC3");
                                         jjj_div.removeChild(NC3);
                                        var NC4=document.getElementById("NC4");
                                         jjj_div.removeChild(NC4);
                                    }
                                    if(document.getElementById("ertong_xiala_jd").value==1)//如果有1个儿童
                                    {
                                           document.getElementById("NA1").value="2";
                                           document.getElementById("NA2").value="2";
                                       var NA3=document.getElementById("NA3");
                                       jjj_div.removeChild(NA3);
                                       var NA4=document.getElementById("NA4");
                                        jjj_div.removeChild(NA4);
                                       var NA5=document.getElementById("NA5");
                                        jjj_div.removeChild(NA5);
                                        
                                        document.getElementById("NC1").value="1";
                                        
                                        var NC2=document.getElementById("NC2");
                                         jjj_div.removeChild(NC2);
                                        var NC3=document.getElementById("NC3");
                                         jjj_div.removeChild(NC3);
                                        var NC4=document.getElementById("NC4");
                                         jjj_div.removeChild(NC4);
                                    }

                              }
                              if(document.getElementById("chengren_xiala_jd").value==5)//如果是2间房如果有5个成人
                              {
                                           document.getElementById("NA1").value="3";
                                           document.getElementById("NA2").value="2";
                                   var NA3=document.getElementById("NA3");
                                   jjj_div.removeChild(NA3);
                                   var NA4=document.getElementById("NA4");
                                    jjj_div.removeChild(NA4);
                                   var NA5=document.getElementById("NA5");
                                    jjj_div.removeChild(NA5);
                                    
                                    var NC1=document.getElementById("NC1");
                                     jjj_div.removeChild(NC1);
                                    var NC2=document.getElementById("NC2");
                                     jjj_div.removeChild(NC2);
                                    var NC3=document.getElementById("NC3");
                                     jjj_div.removeChild(NC3);
                                    var NC4=document.getElementById("NC4");
                                     jjj_div.removeChild(NC4);

                              }
                
                  }
                  
                  if(document.getElementById("jiudianfangjian").value==3) //如果是3间房
                   {
                     
                              var jjj_div=document.getElementById("jjj_input");
                              if(document.getElementById("chengren_xiala_jd").value==3)//如果是3间房如果有3个成人
                              {
                                        if(document.getElementById("ertong_xiala_jd").value==0)//如果有0个儿童
                                        {
                                           document.getElementById("NA1").value="1";
                                           document.getElementById("NA2").value="1";
                                           document.getElementById("NA3").value="1";
                                           var NA4=document.getElementById("NA4");
                                            jjj_div.removeChild(NA4);
                                           var NA5=document.getElementById("NA5");
                                            jjj_div.removeChild(NA5);
                                            
                                            var NC1=document.getElementById("NC1");
                                             jjj_div.removeChild(NC1);
                                            var NC2=document.getElementById("NC2");
                                             jjj_div.removeChild(NC2);
                                            var NC3=document.getElementById("NC3");
                                             jjj_div.removeChild(NC3);
                                            var NC4=document.getElementById("NC4");
                                             jjj_div.removeChild(NC4);
                                           
                                        }
                                        if(document.getElementById("ertong_xiala_jd").value==1)//如果有1个儿童
                                        {
                                           document.getElementById("NA1").value="1";
                                           document.getElementById("NA2").value="1";
                                           document.getElementById("NA3").value="1";
                                           var NA4=document.getElementById("NA4");
                                            jjj_div.removeChild(NA4);
                                           var NA5=document.getElementById("NA5");
                                            jjj_div.removeChild(NA5);
                                            
                                            document.getElementById("NC1").value="1";
                                             
                                            var NC2=document.getElementById("NC2");
                                             jjj_div.removeChild(NC2);
                                            var NC3=document.getElementById("NC3");
                                             jjj_div.removeChild(NC3);
                                            var NC4=document.getElementById("NC4");
                                             jjj_div.removeChild(NC4);
                                           
                                        }
                                        if(document.getElementById("ertong_xiala_jd").value==2)//如果有2个儿童
                                        {
                                           document.getElementById("NA1").value="1";
                                           document.getElementById("NA2").value="1";
                                           document.getElementById("NA3").value="1";
                                           var NA4=document.getElementById("NA4");
                                            jjj_div.removeChild(NA4);
                                           var NA5=document.getElementById("NA5");
                                            jjj_div.removeChild(NA5);
                                            
                                            document.getElementById("NC1").value="1";
                                            document.getElementById("NC2").value="1";
                                            
                                            var NC3=document.getElementById("NC3");
                                             jjj_div.removeChild(NC3);
                                            var NC4=document.getElementById("NC4");
                                             jjj_div.removeChild(NC4);
                                           
                                        }
                               }
                               
                               if(document.getElementById("chengren_xiala_jd").value==4)//如果是3间房如果有4个成人
                                 
                                 {
                                      if(document.getElementById("ertong_xiala_jd").value==0)//如果有0个儿童
                                      {
                                           document.getElementById("NA1").value="2";
                                           document.getElementById("NA2").value="1";
                                           document.getElementById("NA3").value="1";
                                           var NA4=document.getElementById("NA4");
                                            jjj_div.removeChild(NA4);
                                           var NA5=document.getElementById("NA5");
                                            jjj_div.removeChild(NA5);
                                            
                                            var NC1=document.getElementById("NC1");
                                             jjj_div.removeChild(NC1);
                                            var NC2=document.getElementById("NC2");
                                             jjj_div.removeChild(NC2);
                                            var NC3=document.getElementById("NC3");
                                             jjj_div.removeChild(NC3);
                                            var NC4=document.getElementById("NC4");
                                             jjj_div.removeChild(NC4);
                                      }
                                      if(document.getElementById("ertong_xiala_jd").value==1)//如果有1个儿童
                                      {
                                           document.getElementById("NA1").value="2";
                                           document.getElementById("NA2").value="1";
                                           document.getElementById("NA3").value="1";
                                           var NA4=document.getElementById("NA4");
                                            jjj_div.removeChild(NA4);
                                           var NA5=document.getElementById("NA5");
                                            jjj_div.removeChild(NA5);
                                            
                                            document.getElementById("NC2").value="1";
                                            var NC1=document.getElementById("NC1");
                                             jjj_div.removeChild(NC2);
                                            var NC3=document.getElementById("NC3");
                                             jjj_div.removeChild(NC3);
                                            var NC4=document.getElementById("NC4");
                                             jjj_div.removeChild(NC4);
                                      }
                                }
                                
                                if(document.getElementById("chengren_xiala_jd").value==5)//如果是3间房如果有5个成人
                                
                                {
                                           document.getElementById("NA1").value="2";
                                           document.getElementById("NA2").value="2";
                                           document.getElementById("NA3").value="1";
                                       var NA4=document.getElementById("NA4");
                                        jjj_div.removeChild(NA4);
                                       var NA5=document.getElementById("NA5");
                                        jjj_div.removeChild(NA5);
                                        
                                        var NC1=document.getElementById("NC1");
                                         jjj_div.removeChild(NC1);
                                        var NC2=document.getElementById("NC2");
                                         jjj_div.removeChild(NC2);
                                        var NC3=document.getElementById("NC3");
                                         jjj_div.removeChild(NC3);
                                        var NC4=document.getElementById("NC4");
                                         jjj_div.removeChild(NC4);
                                }
                            
                   }
                   
                    if(document.getElementById("jiudianfangjian").value==4) //如果是4间房
                    {
                                var jjj_div=document.getElementById("jjj_input");
                                if(document.getElementById("chengren_xiala_jd").value==4)//如果是4间房如果有4个成人
                                {
                                                if(document.getElementById("ertong_xiala_jd").value==0)//如果有0个儿童
                                                {
                                                   document.getElementById("NA1").value="1";
                                                   document.getElementById("NA2").value="1";
                                                   document.getElementById("NA3").value="1";
                                                   document.getElementById("NA4").value="1";
         
                                                   var NA5=document.getElementById("NA5");
                                                    jjj_div.removeChild(NA5);
                                                    
                                                    var NC1=document.getElementById("NC1");
                                                     jjj_div.removeChild(NC1);
                                                    var NC2=document.getElementById("NC2");
                                                     jjj_div.removeChild(NC2);
                                                    var NC3=document.getElementById("NC3");
                                                     jjj_div.removeChild(NC3);
                                                    var NC4=document.getElementById("NC4");
                                                     jjj_div.removeChild(NC4);
                                                   
                                                }
                                                if(document.getElementById("ertong_xiala_jd").value==1)//如果有1个儿童
                                                {
                                                   document.getElementById("NA1").value="1";
                                                   document.getElementById("NA2").value="1";
                                                   document.getElementById("NA3").value="1";
                                                   document.getElementById("NA4").value="1";
         
                                                   var NA5=document.getElementById("NA5");
                                                    jjj_div.removeChild(NA5);
                                                    
                                                    document.getElementById("NC1").value="1";
                                                    var NC2=document.getElementById("NC2");
                                                     jjj_div.removeChild(NC2);
                                                    var NC3=document.getElementById("NC3");
                                                     jjj_div.removeChild(NC3);
                                                    var NC4=document.getElementById("NC4");
                                                     jjj_div.removeChild(NC4);
                                                }
                                }
                                if(document.getElementById("chengren_xiala_jd").value==5)//如果是4间房如果有5个成人
                                {
                                                   document.getElementById("NA1").value="2";
                                                   document.getElementById("NA2").value="1";
                                                   document.getElementById("NA3").value="1";
                                                   document.getElementById("NA4").value="1";
                                                    
                                                    var NA5=document.getElementById("NA5");
                                                    jjj_div.removeChild(NA5);
                                                    var NC1=document.getElementById("NC1");
                                                     jjj_div.removeChild(NC1);
                                                    var NC2=document.getElementById("NC2");
                                                     jjj_div.removeChild(NC2);
                                                    var NC3=document.getElementById("NC3");
                                                     jjj_div.removeChild(NC3);
                                                    var NC4=document.getElementById("NC4");
                                                     jjj_div.removeChild(NC4);
                                }                        
                    }
                    
                    if(document.getElementById("jiudianfangjian").value==5) //如果是5间房
                    {
                                                   var jjj_div=document.getElementById("jjj_input");
                                                   document.getElementById("NA1").value="1";
                                                   document.getElementById("NA2").value="1";
                                                   document.getElementById("NA3").value="1";
                                                   document.getElementById("NA4").value="1";
                                                   document.getElementById("NA5").value="1";
                                                    
                                                    var NC1=document.getElementById("NC1");
                                                     jjj_div.removeChild(NC1);
                                                    var NC2=document.getElementById("NC2");
                                                     jjj_div.removeChild(NC2);
                                                    var NC3=document.getElementById("NC3");
                                                     jjj_div.removeChild(NC3);
                                                    var NC4=document.getElementById("NC4");
                                                     jjj_div.removeChild(NC4);
                    }
  
                  document.getElementById('form_hbsel_jjj').action="http://new.hnair.com/hainanair/ibe/deeplink/ancillary.do";
                  document.getElementById('form_hbsel_jjj').submit();
                   
              }
               
             
        }
        else if(str_type=="form_hbdt")//航班动态查询
        {
                  var zt = document.getElementsByName("radio2");
                  var str_check="";
                  for(var i=0;i<zt.length;i++)
                  {
                      if(zt[i].checked) 
                      {
                        str_check=zt[i].value;
                      }
                  }
              if(str_check=="1") //按航班号
              {
                  document.getElementById("Nation").value="CHN"; //
                  document.getElementById("flightCode").value=document.getElementById("gongsidm_hbdt").value; //航空公司代码
                  document.getElementById("flightNo").value=document.getElementById("hangbanhao_hbdt").value;         //出发城市 
                  document.getElementById("takeoffDate").value=document.getElementById("ahbcx_riqi").value;       //出发日期
                  document.getElementById('form_hbdt').action="http://opcflt.hnair.com/hnairweb/findFlightByNum.do";
                  document.getElementById('form_hbdt').submit();
              }
              else //按行程
              {
                  if(document.getElementById("city_name3").value=="")
                  {
                    alert("请选择出发城市");
                    return false;
                  }
                  if(document.getElementById("city_name4").value=="")
                  {
                    alert("请选择到达城市");
                    return false;
                  }
                  document.getElementById("Nation").value="CHN"; //
                  document.getElementById("dstCity").value=getchengshi_szm(document.getElementById("city_name4").value); //到达城市3字码
                  document.getElementById("dstCity_input").value=document.getElementById("city_name4").value;         //到达城市 
                  document.getElementById("orgCity").value=getchengshi_szm(document.getElementById("city_name3").value);       //出发城市3字码
                  document.getElementById("orgCity_input").value=document.getElementById("city_name3").value;       //出发城市 
                  document.getElementById("takeoffDate").value=document.getElementById("ahbcx_riqi").value;       //出发日期
                  document.getElementById('form_hbdt').action="http://opcflt.hnair.com/hnairweb/findFlightByDate.do";
                  document.getElementById('form_hbdt').submit();
              }

        }
        else if(str_type=="form_blcj_fw")
        {
                
                  var zt = document.getElementsByName("radio3");
                  var str_check="";
                  for(var i=0;i<zt.length;i++)
                  {
                      if(zt[i].checked) 
                      {
                        str_check=zt[i].value;
                      }
                  }
              if(str_check=="1") //办理乘机
              {
 
                  if(document.getElementById("IDcard").value=="")
                  {
                    alert("请输入证件号");
                    return false;
                  }
                  if(document.getElementById("city_name7").value=="")
                  {
                    alert("请选择出发城市");
                    return false;
                  }
                  document.getElementById("ID").value=document.getElementById("IDcard").value; //证件号
                  document.getElementById("IDType").value=document.getElementById("zhengjianlx_blcj").value; //证件号类型
                  document.getElementById("cusscitycode").value=getchengshi_szm(document.getElementById("city_name7").value);         //出发城市 3字码
                  document.getElementById("language").value="CN";       //语言类型
                  document.getElementById("orgid").value="HUAIRNEW";        
                  document.getElementById("version").value="new";  
                  document.getElementById('form_blcj').action="http://webcheckin.travelsky.com/webcki/HuFlightQuery.do";
                  
                  document.getElementById('form_blcj').submit();
              }
              else //办理乘机查询
              {
                  if(document.getElementById("IDcard").value=="")
                  {
                    alert("请输入证件号");
                    return false;
                  }
                  if(document.getElementById("city_name7").value=="")
                  {
                    alert("请选择出发城市");
                    return false;
                  }
                  document.getElementById("idno_cx").value=document.getElementById("IDcard").value; //证件号
                  document.getElementById("idtype_cx").value=document.getElementById("zhengjianlx_blcj").value; //证件号类型
                  document.getElementById("org_cx").value=getchengshi_szm(document.getElementById("city_name7").value);        //出发城市 3字码
                  document.getElementById("language_cx").value="CN";       //语言类型
                  document.getElementById("orgid_cx").value="HUAIRNEW";        
                  document.getElementById("version_cx").value="new";  

                   document.getElementById('form_blcjcx').action="http://webcheckin.travelsky.com/webcki/HUBC10CussQueryFront.do";
                  document.getElementById('form_blcjcx').submit();
              }
        
        }
        else if(str_type=="form_cssq_fw")
        {
               var zt = document.getElementsByName("radio4");
                  var str_check="";
                  for(var i=0;i<zt.length;i++)
                  {
                      if(zt[i].checked) 
                      {
                        str_check=zt[i].value;
                      }
                  }
              if(str_check=="1") //办理乘机
              {
                  if(document.getElementById("cardnumber_canshisq").value=="")
                  {
                    alert("请输入证件号");
                    return false;
                  }
                  if(document.getElementById("name_canshisq").value=="")
                  {
                    alert("请输入旅客姓名");
                    return false;
                  }
                  document.getElementById("applyID").value=document.getElementById("cardnumber_canshisq").value;; //证件号
                  document.getElementById("IDType_cssq").value=document.getElementById("zhengjianlx_cssq").value; //证件号类型
                  document.getElementById("passName").value=document.getElementById("name_canshisq").value;         //旅客姓名
              
                  document.getElementById('form_cssq').action="http://new.hnair.com/hainanair/ibe/extras/mealSearch.do";
                  document.getElementById('form_cssq').submit();
              }
              else //办理乘机查询
              {
                  if(document.getElementById("pingzhenghm_cssq_cx").value=="")
                  {
                    alert("请输入证件号");
                    return false;
                  }
                  if(document.getElementById("name_canshisq").value=="")
                  {
                    alert("请输入旅客姓名");
                    return false;
                  }
                  document.getElementById("searchID").value=document.getElementById("pingzhenghm_cssq_cx").value; //证件号
                  document.getElementById("searchType").value=document.getElementById("zhengjianlx_cssq_cx").value; //证件号类型
                  document.getElementById("passName_cx").value=document.getElementById("name_canshisq").value;         //旅客姓名
           
                  document.getElementById('form_cssqcx').action="http://new.hnair.com/hainanair/ibe/extras/mealChanceSearch.do";
                  document.getElementById('form_cssqcx').submit();
              }
        
        }
        else if(str_type=="form_ddcx")
        {
        
   
                  if(document.getElementById("sjyzm_ddcx").value=="")
                  {
                    alert("请输入验证码");
                    return false;
                  }
                  if(document.getElementById("sjhm_ddcx").value=="")
                  {
                    alert("请输入手机号");
                    return false;
                  }
                  if(checkPhone(document.getElementById("sjhm_ddcx").value))
                  {
                  
                  }else
                  {
                    alert("请输入合法的手机号");
                    return false;
                  }
                  if(document.getElementById("pzhm_ddcx").value=="")
                  {
                    alert("请输入证件号");
                    return false;
                  }
                  if(document.getElementById("kph_ddcx").value=="客票号")
                  {
                    var inuptObjec= document.getElementById("bookingSearch/TicketNumber");
                    inuptObjec.name="bookingSearch/TicketNumber";
                    inuptObjec.value=document.getElementById("pzhm_ddcx").value;
                     
                  }
                  else
                  {
                    var inuptObjec= document.getElementById("bookingSearch/TicketNumber");
                    inuptObjec.name="bookingSearch/reference";
                    inuptObjec.value=document.getElementById("pzhm_ddcx").value;
                    
                  }
                  //document.getElementById("bookingSearch/reference").value=document.getElementById("pzhm_ddcx").value; //PNR号
                  document.getElementById("telephone").value=document.getElementById("sjhm_ddcx").value;         //手机号码
                  document.getElementById("telephoneCode").value=document.getElementById("sjyzm_ddcx").value;         //手机验证码
                  document.getElementById('form_ddcx').action="http://new.hnair.com/hainanair/ibe/bookingManagement/home.do";
                  document.getElementById('form_ddcx').submit();

        
        }
        
      }



 
